/***************************************************************************
 *   Copyright (C) 2007 by Sebastian Bilski, Lance Cooper, Jeff Rebacz,
 *   									and Alex Zelenskiy
 *   sbilski@iit.edu
 *   lance.m.cooper@gmail.com
 *   jeff.rebacz@gmail.com
 *   voiceofanarchy@gmail.com
 *
 *	This file is part of connect3
 *
 *   connect3 is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License, version 2,
 *    as published by the Free Software Foundation
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program; if not, write to the
 *   Free Software Foundation, Inc., 
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
 ***************************************************************************/

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JComponent;


public class JConnect3Slot extends JButton{
	
	Color color = new Color(200, 200, 210);
	public JConnect3Slot(){
		super("  ");
		int x = getWidth();
		setSize(x, x);
	}
	
	public void setBackground(Color _color){
		color=_color;
		paint(getGraphics());
	}
	
	public void paint(Graphics g){
		
		Graphics2D g2 = (Graphics2D)g;
		
		
		int x = getWidth();
		int y = getHeight();
		
		
		int xPos=getVisibleRect().x;
		int yPos=getVisibleRect().y;
		
		if(g2!=null){
			g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
			g2.setColor(new Color(200, 200, 200));
			g2.fillRect(xPos, yPos, x, y);
			g2.setColor(new Color(220, 220, 220));
			g2.fillRect(xPos+1, yPos+1, x-1, y-1);
						
			g2.setColor(color);
			g2.fillOval(xPos+2, yPos+2, x-4, y-4);			
		}
	}

}
